package org.bits.ui.model;

import java.util.Arrays;

import org.bits.common.model.ItemTableModel;
import org.bits.data.Product;

public class ProductsTableModel extends ItemTableModel<Product>
{
    public static final String[] HEADINGS;
    public static final Class<?>[] COLUMN_CLASSES;

    static
    {
        HEADINGS = new String[] { "Name" };
        COLUMN_CLASSES = new Class<?>[] { String.class };
    }

    public ProductsTableModel()
    {
        setColumnNames( Arrays.asList( HEADINGS ) );
        setColumnClasses( Arrays.asList( COLUMN_CLASSES ) );
    }

    @Override
    protected Object getValueAtColumn( Product item, int col )
    {
        switch( col )
        {
            case 0:
                return item.name;
        }

        throw new IllegalArgumentException( "The column " + col +
            " is invalid." );
    }

}
